package com.block.datapush.service.apipush.utils;

import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.block.common.enums.BaseTypeInfoEnum;

/**
 * 78 信业帮
 */
public class XinYeBangUtil {


    public static Integer getSocialInsurance(String shebao) {
        if (StrUtil.equals(BaseTypeInfoEnum.Shebao.sb001.getValue(), shebao)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Shebao.sb002.getValue(), shebao)) {
            return 3;
        }
        return 6;
    }

    public static Integer getLoanAmount(String amount) {
        if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la001.getValue(), amount)) {
            return 2;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la002.getValue(), amount)) {
            return 4;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la003.getValue(), amount)) {
            return 8;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la004.getValue(), amount)) {
            return 15;
        }
        return 20;
    }




    public static Integer getGjj(String gongjijin) {
        if (StrUtil.equals(BaseTypeInfoEnum.Gjj.gjj001.getValue(), gongjijin)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Gjj.gjj002.getValue(), gongjijin)) {
            return 3;
        }
        return 6;
    }


    public static Integer getCar(String car) {
        if (StrUtil.equals(BaseTypeInfoEnum.Car.car001.getValue(), car)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Car.car002.getValue(), car)) {
            return 3;
        }
        return 2;
    }

    public static JSONObject getCarData(String car) {
        JSONObject jsonObject = new JSONObject();
        if (!StrUtil.equals(BaseTypeInfoEnum.Car.car001.getValue(), car)) {
            jsonObject.put("car_price", -1);
        }
        return jsonObject;
    }


    public static Integer getHouse(String house) {
        if (StrUtil.equals(BaseTypeInfoEnum.House.hu001.getValue(), house)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.House.hu003.getValue(), house)) {
            return 2;
        }
        return 1;
    }

    public static JSONObject getHouseData(String house) {
        JSONObject jsonObject = new JSONObject();
        if (!StrUtil.equals(BaseTypeInfoEnum.House.hu001.getValue(), house)) {
            jsonObject.put("house_type", -1);
            jsonObject.put("house_price", -1);
        }
        return jsonObject;
    }


    public static Integer getyuqi(String yuqi) {
        if (StrUtil.equals(BaseTypeInfoEnum.Yuqi.yq001.getValue(), yuqi)) {
            return 3;
        }
        return 2;
    }

    public static Integer getxueli(String xueli) {
        if (StrUtil.equals(BaseTypeInfoEnum.XueLi.xl001.getValue(), xueli)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.XueLi.xl002.getValue(), xueli)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.XueLi.xl003.getValue(), xueli)) {
            return 3;
        }
        return 4;
    }

    public static Integer getjob(String job) {
        if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz002.getValue(), job)) {
            return 2;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz003.getValue(), job)) {
            return 1;
        }
        return 0;
    }


    public static Integer getShouru(String shouru) {
        if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr001.getValue(), shouru)) {
            return 4000;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr002.getValue(), shouru)) {
            return 8000;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr003.getValue(), shouru)) {
            return 10000;
        }
        return 20000;
    }


    public static JSONObject getjobData(String job,Integer shouru) {
        JSONObject Data = new JSONObject();
        if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz002.getValue(), job)) {
            Data.put("year_income", -1);
            Data.put("is_license",-1);
            Data.put("operating_years",-1);
        } else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz003.getValue(), job)) {
            Data.put("month_income", shouru);
        }else{
            Data.put("month_income", shouru);
            Data.put("income_type",-1);
            Data.put("work_unit","未知");
            Data.put("workage",-1);
        }
        return Data;
    }


    public static Integer getloanTime(String loanTime) {
        if (StrUtil.equals(BaseTypeInfoEnum.LoanTime.lt001.getValue(), loanTime)) {
            return 3;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanTime.lt002.getValue(), loanTime)) {
            return 6;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanTime.lt003.getValue(), loanTime)) {
            return 12;
        }
        return 24;
    }



    public static Integer getbaodan(String baodan) {
        if (StrUtil.equals(BaseTypeInfoEnum.Baoxian.bx001.getValue(), baodan)) {
            return 0;
        }
        return 1;
    }

    public static JSONObject getbaodanData(String baodan) {
        JSONObject jsonObject = new JSONObject();
        if (!StrUtil.equals(BaseTypeInfoEnum.Baoxian.bx001.getValue(), baodan)) {
            jsonObject.put("insurance_price", -1);
            jsonObject.put("insurance_company", 10);
        }
        return jsonObject;
    }


    public static Integer getYongtu(String yongtu) {
        if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt001.getValue(), yongtu)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt004.getValue(), yongtu)) {
            return 3;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt003.getValue(), yongtu)) {
            return 4;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt002.getValue(), yongtu)) {
            return 2;
        }
        return 7;
    }



    public static Integer getZhimaScore(String zhima) {
        if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm003.getValue(), zhima)) {
            return 630;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm004.getValue(), zhima)) {
            return 670;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm005.getValue(), zhima)) {
            return 700;
        }
        return 599;
    }

}
